package leetcode_181_200;

import leetcode_161_180.*;
import org.junit.Test;
import utils.TreeNode;

import java.util.Arrays;

public class Test10 {

    @Test
    //重复的DNA序列
    public void test187() {
        String s="AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT";
        System.out.println(new findRepeatedDnaSequences_187().findRepeatedDnaSequences2(s));
    }
    @Test
    //买卖股票的最佳时机 IV
    public void test188() {
        int[] nums={3,2,6,5,0,3};
        System.out.println(new maxProfit_188().maxProfit(2,nums));
    }
    @Test
    //轮转数组
    public void test189() {
        int[] nums={1,2,3,4,5,6,7};
        new rotate_189().rotate(nums,3);
    }

    @Test
    //颠倒二进制位
    public void test190() {
        int n=-3;
        System.out.println(new reverseBits_190().reverseBits(n));
    }

    @Test
    //颠倒二进制位
    public void test191() {
        int n=11;
        System.out.println(new hammingWeight_191().hammingWeight(n));
    }

    @Test
    //打家劫舍
    public void test198() {
        int[] nums={4,1,2,7,5,3,1};
        System.out.println(new rob_198().rob(nums));
    }

    @Test
    //二叉树的右视图
    public void test199() {
        TreeNode treeNode1=new TreeNode(1);
        TreeNode treeNode2=new TreeNode(2);
        TreeNode treeNode3=new TreeNode(3);
        TreeNode treeNode4=new TreeNode(4);
        TreeNode treeNode5=new TreeNode(5);

        //1,2,4,5,3
        treeNode1.left=treeNode2;
        treeNode1.right=treeNode3;
        treeNode2.left=treeNode4;
        treeNode4.left=treeNode5;
        System.out.println(new rightSideView_199().rightSideView(treeNode1));
    }

    @Test
    //岛屿数量
    public void test200() {
//        char[][] grid={{'1','1','0','0','0'},
//                {'1','1','0','0','0'},
//                {'0','0','1','0','0'},
//                {'0','0','0','1','1'}};
        char[][] grid={{'1','1','1'},
                {'0','1','0'},
              {'1','1','1'}};
        System.out.println(new numIslands_200().numIslands(grid));
    }
}
